
<!-- 学员详情 -->
<template>
  <div class="student_detail">
    <div class="common_bg"></div>

    <div class="container">
      <div class="info_card card" @click.stop="toStudentInfo($event)">
        <img :src="computedAvatar" alt="" class="avatar">
        <div class="student_info">
          <div class="info1 info">
            <span class="name">{{studentInfo.studentName}}</span>
            <div class="phone_box">
              <i class="icon_phone"></i>
              <a :href="`tel:${studentInfo.linkPhone}`" class="phone">{{studentInfo.linkPhone}}</a>
            </div>
            <i class="icon_idCard"></i>
          </div>
          <div class="info2 info">
            <span class="parent">{{studentInfo.linkPerson}}</span>
            <span class="status" @click.stop="updatePhoneVerification" :class="{'phoneVer' : studentInfo.phoneVerification == 1}">{{studentInfo.phoneVerification == 0 ? '未验证' : '已验证'}}</span>
          </div>
        </div>
      </div>

      <div class="label_card card" @click="toTagDetail()">
        <van-cell is-link>
          <div>
            <i class="icon_label"></i>
            <span class="card_name">标签</span>
          </div>
          <div style="display: flex;flex-wrap: wrap; width: 77%;">
            <span class="label_item" v-for="(item, index) in studentInfo.labelNameList" :key="index">{{item}}</span>
          </div>
        </van-cell>
      </div>

      <div class="follow_card card" @click="toFollowDetail()">
        <van-cell is-link>
          <!-- <div> -->
            <i class="icon_follow"></i>
            <span class="card_name">跟进情况</span>
            <span class="intention_level" v-if="studentInfo.strengthRemark">意向 : {{studentInfo.strengthRemark}}</span>
            <span class="follow_status">{{studentInfo.salesStatusName}}</span>
            <div class="follow_remark">{{studentInfo.remark}}</div>
            <van-divider dashed />
            <ul class="follow_list">
              <li class="follow_item">跟进人 : {{studentInfo.employeesName}}</li>
              <li class="follow_item">跟进次数 : {{studentInfo.followCount}}</li>
              <li class="follow_item" style="width: 100%;">本次跟进时间 : {{studentInfo.currentFollowTime}}</li>
              <li class="follow_item" style="width: 100%;">下次跟进时间 : {{studentInfo.nextFollowTime}}</li>
            </ul>
          <!-- </div> -->
        </van-cell>
      </div>

      <div class="class_card card" v-for="(item, index) in studentInfo.bmAuditionStudentList" @click="toAuditionDetail(item)" :key="index">
        <van-cell is-link >
          <i class="icon_class"></i>
          <span class="card_name">试听课程</span>
          <van-divider />

          <div class="class_box">
            <span class="class_name">{{ item.productName }}</span>
            <div class="sign_in_box" v-if="item.productName" @click.stop="checkInProduct(item)">
              <i :class="computedSignClass(item)"></i>
              <p>{{item.checkStatus == 1 ? '已签到' : '未签到'}}</p>
            </div>
          </div>
        </van-cell>
      </div>

      <div class="more_info" @click="auditioning">更多试听意向？去试听排课看看吧 >></div>
    </div>

    <div class="student_bottom_nav">
      <van-tabbar safe-area-inset-bottom v-model="activeNav" @change="onChangeNav" active-color="#FC8434" inactive-color="#D4D6DB">
        <van-tabbar-item 
          v-for="(item, index) in tabBarList" 
          :key="index"
          >
          <a v-if="item.label == '通话'" :href="`tel:${studentInfo.linkPhone}`">通话</a>
          <span v-else>{{ item.label }}</span>
          <span
            slot="icon"
            :class="item.icon"
          ></span>
        </van-tabbar-item>
      </van-tabbar>
    </div>


    <van-popup v-model="popupStatus" class="popup" position="right" :style="{ height: '100%', width: '100%', background: '#F7F9FF' }">
      <div class="top_bar pop_top_bar">
        <span class="icon_left" @click="popupStatus = false; activeNav = 0"></span> 
        <span class="title">试听排课</span> 
        <span @click="save">完成</span>
      </div>

      <div class="common_bg"></div>
      <div class="pop_container" >
        <ul class="list">
          <li><van-field v-model="formData.studentName" label="学员" disabled /></li>
          <li><van-field v-model="formData.schoolName" label="校区" disabled /></li>
          <li @click="clcikShowBottomArea('product')">
            <van-cell :value="formData.product" is-link>
              <template slot="title">
                <span class="custom-title">课程</span>
              </template>
            </van-cell>
          </li>
          <li @click="clcikShowBottomArea('startTime', 'time')">
            <van-cell :value="formData.startTime" is-link>
              <template slot="title">
                <span class="custom-title">开始时间</span>
              </template>
            </van-cell>
          </li>
          <li @click="clcikShowBottomArea('endTime', 'time')">
            <van-cell :value="formData.endTime" is-link>
              <template slot="title">
                <span class="custom-title">结束时间</span>
              </template>
            </van-cell>
          </li>
          <li @click="clcikShowBottomArea('classRoom')">
            <van-cell :value="formData.classRoom" is-link>
              <template slot="title">
                <span class="custom-title">教室</span>
              </template>
            </van-cell>
          </li>
          <li @click="clcikShowBottomArea('teacher')">
            <van-cell :value="formData.teacher" is-link>
              <template slot="title">
                <span class="custom-title">教师</span>
              </template>
            </van-cell>
          </li>
          
        </ul>

        <div v-if="auditionList.length == 0" class="noData" style="margin-top: 10px;">
          <!-- <img src="../../../assets/img/nodata.png" alt=""> -->
          <p>暂时还没有相关试听课</p>
          <p>快来手动添加吧</p>
          <span class="addData" @click="addAudition">添加</span>
        </div>
        <div v-else class="audition_list">
          <van-cell class="card_cell" @click="toggle(index)"  v-for="(item, index) in auditionList" :key="index">
            <span class="card_name">{{item.productName.join(',')}}</span>
            <van-checkbox
              :name="item"
              v-model="auditionList[index].checked"
              ref="checkboxes"
              slot="default"
            />
            <van-divider />

            <div class="class_box">
              <div class="left">
                <i class="icon_position"></i>
                <span class="school_name">{{item.schoolName}}</span>
              </div>
              <div class="right">
                <ul class="class_info_list">
                  <li class="class_info_item" style="width: 100%">时间 : {{item.classStartTime}}</li>
                  <li class="class_info_item">教师 : {{item.employeesName}}</li>
                  <li class="class_info_item">教室 : {{item.classRoomName}}</li>
                  <li class="class_info_item" style="width: 100%">容纳学员 : {{item.accommodateStudent}}人</li>
                  <li class="class_info_item" style="width: 100%">已安排学员 : {{item.arrangeStudent}}人</li>
                </ul>
              </div>
            </div>
          </van-cell>
        </div>
      </div>
    </van-popup>

    <div class="popup">
      <van-popup v-model="showBottomArea" position="bottom" :style="{ height: '40%' }">
        <van-datetime-picker
          v-if="bottomType == 'date'"
          v-model="currentDate"
          type="datetime"
          :min-date="minDate"
          :formatter="formatter"
          @cancel="onCancel"
          @confirm="onConfirm"
        />

        <van-picker
          v-else
          show-toolbar
          title="请选择"
          value-key="label"
          :columns="bottomAreaList"
          @cancel="onCancel"
          @confirm="onConfirm"
        />
      </van-popup>
    </div>
    
  </div>
</template>



<style>


.student_detail .pop_container input {
  text-align: right;
}
.student_detail .pop_container .van-field__body {
  width: 100%;
}
.student_detail .pop_container .van-cell__value span {
  width: 80%;
}


.audition_list .van-checkbox {
  margin-left: auto;
}
.student_detail .student_bottom_nav .van-tabbar--fixed {
  position: sticky;
}
.student_detail .student_bottom_nav a {
  color: rgb(212, 214, 219);
}
.student_detail .van-cell__value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-right: 10px;
}
.student_detail .van-cell__right-icon {
  position: absolute;
  right: .266667rem;
}
.student_detail .container .van-cell {
  box-shadow:0px 2px 4px 5px rgba(241,241,241,0.5);
  border-radius: .16rem;
}
</style>
<style scoped>
.pop_container {
  position: relative;
  padding: 1.066667rem .266667rem .5rem;
}
.audition_list {
  margin-top: .2rem;
}
.audition_list > div {
  margin-bottom: .133333rem;
}
.list {
  border-radius: .266667rem;
  overflow: hidden;
  background: #fff;
}
.student_detail {
  position: relative;
}

.student_detail .container {
  padding: 0  .266667rem;
  box-sizing: border-box;
  position: relative;
  z-index: 5;
  padding-top: .746667rem;;
}

.student_detail .card {
  margin-bottom: .4rem;
}
.student_detail .info_card {
  width: 100%;
  height: 3.04rem;
  box-shadow:0px 0px 4px 3px rgba(216,216,216,0.5);
  /* border-left: .186667rem solid #8884C3; */
  background: #fff;
  border-radius: .2rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 .333333rem;
  box-sizing: border-box;
}

.student_detail .avatar {
  width: 1.706667rem;
  /* height: 1.706667rem; */
}


.student_detail .student_info {
  width: 100%;
  margin-left: .293333rem;
}

.student_detail .info {
  display: flex;
  width: 100%;
}
.student_detail .info1 {
  display: flex;
  margin-bottom: .373333rem;
  align-items: center;
}
.student_detail .info1 .icon_idCard {
  width: .64rem;
  height: .413333rem;
  background: url('../../../assets/img/icon_idCard.png') 0 0 no-repeat;
  background-size: 100%;
  margin-left: auto;
}
.student_detail .info1 .name {
  font-size: .426667rem;
  color: #666;
  margin-right: .2rem;
}

.student_detail .parent {
  font-size: .32rem;
  color: #666666;
}

.student_detail .status {
  margin-left: auto;
  color: #ff5858;
  font-size: .32rem;
}
.student_detail .phoneVer {
  color: #80D784;
}


.student_detail .label_card {
  /* height: 1.2rem; */
}

.student_detail .icon_label {
  width: .48rem;
  height: .48rem;
  display: inline-block;
  background: url('../../../assets/img/icon_label.png') 0 0 no-repeat;
  background-size: 100%;
}

.student_detail .card_name {
  font-size: .373333rem;
  color: #666666;
  margin-right: .266667rem;
  margin-left: .133333rem;
}
.student_detail .label_item {
  display: flex;
  justify-content: center;
  align-items: center;
  /* min-width: 1.053333rem; */
  padding: 0 .106667rem;
  height: .413333rem;
  background: #FFA7B3;
  font-size: 12px;
  color: #fff;
  margin: .066667rem 0;
  margin-right: .133333rem;
  padding: 2px 7px;
  /* box-sizing: border-box; */
}

.student_detail .follow_card {
  
}
.student_detail .follow_card .icon_follow {
  display: inline-block;
  width: .493333rem;
  height: .493333rem;
  background: url('../../../assets/img/icon_follow.png') 0 0 no-repeat;
  background-size: 100%;
}

.student_detail .intention_level {
  display: inline-block;
  padding: 0 3px;
  box-sizing: border-box;
  font-size: 12px;
  color: #fff;
  background: #8B9DFB;
  margin-left: .186667rem;
  margin-top: 1px;
  line-height: .533333rem;
  border-radius: .106667rem
}

.student_detail .follow_status {
  font-size: .32rem;
  color: #FFC834;
  margin-left: .266667rem;
}

.student_detail .follow_remark {
  width: 100%;
  height: 2.266667rem;
  background: rgba(255,200,52,.12);
  border-radius: .213333rem;
  margin-top: .333333rem;
  padding-left: .133333rem;
  margin-bottom: .133333rem;
}

.student_detail .follow_list {
  font-size: .32rem;
  color: #989898;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
}

.student_detail .follow_item {
  width: 50%;
}



.student_detail .class_box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem 0;
  width: 100%;
}
.student_detail .class_name{
  font-size: .426667rem;
  color: #FC8434;
}
.student_detail .icon_signIn {
  display: inline-block;
  width: 1rem;
  height: 1.013333rem;
  background: url('../../../assets/img/icon_signIn.png') 0 0 no-repeat;
  background-size: 100%;
}
.student_detail .icon_notSignIn {
  display: inline-block;
  width: 1rem;
  height: 1.013333rem;
  background: url('../../../assets/img/icon_notSignIn.png') 0 0 no-repeat;
  background-size: 100%;
}

.student_detail .student_bottom_nav {
  position: sticky;
  bottom: -1px;
  z-index: 99;
}
.student_detail .sign_in_box {
  text-align: center;
  margin-right: .266667rem;
}
.student_detail .sign_in_box p {
  color: #FC8434;
  font-size: .266667rem;
  margin-left: .053333rem;
  line-height: .48rem;
}



.audition_list .class_card .card_cell {
  margin-bottom: .266667rem;
}


.audition_list .van-cell {
  padding: 15px 6px;
}
.audition_list .card_name {
  font-size: .426667rem;
  color: #FC8434;
  margin-right: .566667rem;
  margin-left: .346667rem;
}


.audition_list .class_box {
  display: flex;
  width: 100%;
  padding: .533333rem 0;
}

.audition_list .school_name {
  color: #FFC834;
  font-size: .373333rem;
  margin-top: .32rem;
  text-align: center;
}

.audition_list .left {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  border-right: .5px solid #EFEFEF;
  padding-right: .106667rem;
  width: 60%;
}
.audition_list .right {
  margin-left: .466667rem;
  width: 100%;
}
.audition_list .class_info_list {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  /* justify-content: space-between; */
}
.audition_list .icon_class {
  margin-left: .186667rem;
}
.audition_list .right .class_info_item:not(:last-child) {
  width: 50%;
  margin-bottom: .266667rem;
}


.audition_list .card_name:before {
  content: '';
  width: .453333rem;
  height: .426667rem;
  display: inline-block;
  background: url('../../../assets/img/icon_class.png') 0 0 no-repeat;
  background-size: contain;
  margin-right: .133333rem;
  position: relative;
  top: 2px;
}

.student_detail .list li{
  position: relative;
}
.student_detail .list li:after {
  content: " ";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  border-top: 1px solid #e9e9e9 !important;
  -webkit-transform: scaleY(.5);
  transform:scaleY(.5);
}

.student_detail .list li:first-child:after {
  content: "";
  border-top: none !important;
}



</style>


<script>

import {
  createNamespacedHelpers
} from "vuex";
let {
  mapState,
  mapGetters,
  mapMutations,
  mapActions
} = createNamespacedHelpers("studentDetail");

import avatarBoy from '../../../assets/img/avatarBoy.png'
import avatarGirl from '../../../assets/img/avatarGirl.png'

export default {
  name: 'studentDetail',
  data() {
    return {
      jwtAuth: {},
      activeNav: 0,
      popupStatus: false,
      showBottomArea: false,
      currentDate: new Date(),
      minDate: new Date(2019,0,1),
      bottomType: '',
      bottomAreaList: [],
      formData: {
        studentName: '',
        schoolName: '',
        product: '',
        startTime: '',
        endTime: '',
        classRoom: '',
        teacher: '',
      },
      auditionList: [],
      checkAuditionList: [],
      tabBarList: [
        {
          label: '跟进',
          icon: 'icon-follow',
        },
        {
          label: '通话',
          icon: 'icon-phone',
        },
        {
          label: '试听',
          icon: 'icon-listen',
        },
        {
          label: '购课',
          icon: 'icon-cart',
        },
      ],
      studentInfo: {},
      finished: false,
      loading: false,
      searchValues: '',
      searchType: '',

      productList: [],
      teacherList: [],
      classRoomList: [],
      
    }
  },
  created() {
    console.log(this.$route)
    this.initData();
  },
  mounted() {
  },
  
  methods: {
    ...mapMutations([
      "updateInfo",
    ]),
    ...mapActions([
      "formGet",
      "post"
    ]),

    save() {
      let data = {}
      Object.assign(data, this.formData);

      console.log(this.auditionList);
      data.bmAuditionStudentList = [];
      this.auditionList.forEach(item => {
        if(item.checked) {
          data.person.forEach(personItem => {
            let obj = {
              auditionMid: item.auditionMid,
              checkStatus: "0",
              personId: personItem.employeesId,
              personName: personItem.employeesName,
              studentId: this.formData.studentId,
            }
            data.bmAuditionStudentList.push(obj)
          })
            
        }
      })

      console.log(data);
      // return false;

      this.post({
        API: 'updateStudentForAllocation',
        data: {
          bmAuditionStudentList: data.bmAuditionStudentList
        },
      }).then(res => {
        this.$notify({ type: 'success', message: '排课成功',duration: 1200 });
        this.popupStatus = false;
        this.initData();
        
      })
    },

    initData() {
      let studentId = this.$route.params.id

      this.formGet({
        API: 'selectById',
        data: {
          id: studentId
        }
      }).then(res => {
        this.studentInfo = res;
        console.log(this.studentInfo.salesStatus);
        this.studentInfo.linkPhone = this.studentInfo.bmStudentParentList[0].linkPhone
        this.studentInfo.linkPerson = this.studentInfo.bmStudentParentList[0].linkPerson
        this.studentInfo.phoneVerification = this.studentInfo.bmStudentParentList[0].phoneVerification

        if(this.studentInfo.bmStudentEmployeesList.length > 0) {
          this.studentInfo.employeesName = this.studentInfo.bmStudentEmployeesList[0].employeesName
        }
        if(this.studentInfo.bmFollowList.length > 0) {
          this.studentInfo.currentFollowTime = this.studentInfo.bmFollowList[0].createTime
        }
        if(this.studentInfo.bmFollowList.length > 0) {
          this.studentInfo.nextFollowTime = this.studentInfo.bmFollowList[0].nextFollowTime;
          this.studentInfo.strengthRemark = this.studentInfo.bmFollowList[0].strengthRemark;
        }

        switch (this.studentInfo.salesStatus) {
          case '10130':
            this.studentInfo.salesStatusName = '待跟进'
            break;
          case '10131':
            this.studentInfo.salesStatusName = '已跟进'
            break;
          case '10132':
            this.studentInfo.salesStatusName = '已定金'
            break;
          case '10133':
            this.studentInfo.salesStatusName = '已试听'
            break;
          case '10134':
            this.studentInfo.salesStatusName = '退定金'
            break;
          case '10135':
            this.studentInfo.salesStatusName = '停止跟进'
            break;
          case '10136':
            this.studentInfo.salesStatusName = '已购课'
            break;
        
          default:
            break;
        }
        this.studentInfo.labelNameList = []
        this.studentInfo.bmStudentLabelList.forEach(item => {
          this.studentInfo.labelNameList.push(item.labelManagementName)
        })

        if(this.studentInfo.bmAuditionStudentList.length == 0) {
          this.studentInfo.bmAuditionStudentList = [{}]
        }

      })
    },

    initAuditionData() {
      let data = {}
      data.employeesId = this.formData.teacherId
      data.productId = this.formData.productId
      data.schoolId = [this.formData.schoolId]
      data.classStartTime = this.formData.startTime
      data.classEndTime = this.formData.endTime
      data.classRoomId = this.formData.classRoomId
      
      this.post({
        API: 'selectBmAuditionManagementPageList',
        data: data
      }).then(res => {
        res.data.forEach(item => {
          let productName = [];
          item.productIdList.forEach(item => {
            productName.push(item.productName)
          })

          item.productName = productName;
        })

        this.auditionList = res.data;
        this.auditionList.forEach(item => {
          item.checked = false;
        })
      })
    },

    clcikShowBottomArea(type, bottomType) {
      
      console.log(type)
      this.searchType = type;
      if(bottomType == 'time') {
        this.bottomType = 'date';
      }else{
        this.bottomType = '';
      }

      this.bottomAreaList = []
      switch (type) {
        case 'product':
          console.log('aaa')
          this.bottomAreaList = this.productList;
          break;
        case 'startTime':

          break;
        case 'endTime':

          break;
        case 'classRoom':
          this.bottomAreaList = this.classRoomList;
          break;
        case 'teacher':
          this.bottomAreaList = this.teacherList;
          break;
      
        default:
          break;
      }

      this.showBottomArea = true;
    },

    toTagDetail() {
      this.$router.push({
        name: 'tagDetail',
        params: {
          id: this.$route.params.id
        }
      })
    },
    toFollowDetail() {
      this.$router.push({
        name: 'followDetail',
        params: {
          id: this.$route.params.id
        }
      })
    },
    toStudentInfo(event) {
      if(event.srcElement.tagName == 'A') {
        return false;
      }
      this.$router.push({
        name: 'addStudent',
        params: {
          id: this.$route.params.id
        }
      })
    },
    addAudition() {
      this.$router.push({
        name: 'addAudition',
        params: {
          type: 'add',
        }
      })
    },
    toAuditionDetail(item) {
      // console.log(item)
      if(item.productName) {
        this.$router.push({
          name: 'addAudition',
          params: {
            type: 'update',
            id: item.auditionMid
          }
        })
      }else{
        this.$dialog.confirm({
          message: '该学员无试听课，是否前往创建'
        }).then(() => {
          this.$router.push({
            name: 'addAudition',
            params: {
              type: 'add',
            }
          })
        }).catch(() => {
          // on cancel
        });
        
      }
    },

    onConfirm(value, index) {
      console.log(value)
      console.log(this.searchType);

      if(this.searchType == 'startTime' || this.searchType == 'endTime') {
        this.formData[this.searchType] = this.format(value)
      }else{
        this.formData[this.searchType] = value.label;
        this.formData[`${this.searchType}Id`] = value.id;
      }
      

      console.log(this.formData);
      this.initAuditionData();

      this.showBottomArea = false;

    },
    onCancel() {
      this.showBottomArea = false;
    },

    checkInProduct(item) {
      if(item.checkStatus == 1) {
        return false;
      }
      let data = {
        bmAuditionStudents: [
          {
            auditionMid: item.auditionMid,
            studentId: item.studentId,
            checkStatus: '1',
          }
        ]
      }
      this.post({
        API: 'updateCheckStatus',
        data: data
      }).then(res => {
        this.$notify({ type: 'success', message: '签到成功',duration: 1200 });
        this.initData();
      })
    },

    onLoad() {
      // 异步更新数据
      console.log('异步更新数据')
      // setTimeout(() => {
      //   for (let i = 0; i < 10; i++) {
      //     this.list.push(this.list.length + 1);
      //   }
      //   // 加载状态结束
      //   this.loading = false;

      //   // 数据全部加载完成
      //   if (this.list.length >= 40) {
      //     this.finished = true;
      //   }
      // }, 500);
    },
    updatePhoneVerification(item) {
      if(this.studentInfo.phoneVerification == 1) {
        return false;
      }

      this.$dialog.confirm({
        message: '该手机号是否已验证？'
      }).then(() => {
        this.post({
          API: 'updatePhoneVerification',
          data: {
            linkPhone: this.studentInfo.linkPhone,
            studentId: this.$route.params.id,
            phoneVerification: '1'
          }
        }).then(res => {
          this.$notify({ type: 'success', message: '验证成功',duration: 1200 });
          this.initData();
        })
      }).catch(() => {
        // on cancel
      });

      
    },

    onChangeNav(index) {
      if(index == 1){
        this.activeNav = 0;
      }
      if(index == 2) {
        this.auditioning();
      }
      if(index == 3) {
        this.$toast.fail('请到斑马公学电脑端进行购课报名！');
        this.activeNav = 0;
        return false;
      }
      // Notify({ type: 'primary', message: index });
    },


    // 试听排课
    auditioning() {
      this.popupStatus = true;
      for(let i in this.formData) {
        this.formData[i] = ''
      }
      console.log(this.studentInfo)
      this.formData.studentName = this.studentInfo.studentName
      this.formData.studentId = this.studentInfo.studentId

      this.formData.person = this.studentInfo.bmStudentEmployeesList

      this.formData.schoolId = this.studentInfo.schoolId
      this.formData.schoolName = this.studentInfo.schoolName
      // Object.assign(this.formData, this.studentInfo)
      this.initAuditionData();
      this.queryAllSubject();
      this.queryAllClassRoom();
      this.queryAllTeacher();
      // console.log(this.formData)

      
    },


    queryAllSubject() {
      let data = {
        schoolId: this.formData.schoolId,
      }
      this.formGet({
        API: 'queryProductBySchool',
        data: data
      }).then(res => {
        res.map((val) => {
          val.id = val.productId;
          val.label = val.productName;
        })
        this.productList = res;
      }).catch(err => {
        this.$toast.fail(err);
      })
    },
    queryAllClassRoom() {
      this.formGet({
        API: 'queryClassRoomBySchool',
        data: {
          schoolId: this.formData.schoolId
        }
      }).then(res => {
        res.map((val) => {
          val.label = val.classRoomName;
          val.id = val.classRoomId;
        })
        this.classRoomList = res;
      })
    },
    queryAllTeacher() {
      this.formGet({
        API: 'queryPersonBySchoolId',
        data: {
          positionCode: '9',
          schoolId: this.formData.schoolId,
        }
      }).then(res => {
        res.map((val) => {
          val.id = val.employeesId;
          val.label = val.employeesName;
        })
        this.teacherList = res;
      }).catch(err => {
        this.$toast.fail(err);
      })
    },


    toggle(index) {
      console.log(index);
      // console.log(this.$refs.checkboxes);
      this.auditionList[index].checked = !this.auditionList[index].checked
      if(this.auditionList[index].checked) {
        this.checkAuditionList.push(this.auditionList[index])
      }else{
        this.checkAuditionList.splice(index, 1);
      }
      this.$forceUpdate();
      // this.$refs.checkboxes[index].toggle();
    },
    format(date) {
      let month = (date.getMonth()+1) > 9 ? (date.getMonth()+1) : "0" + (date.getMonth()+1);
      let day = (date.getDate()) > 9 ? (date.getDate()) : "0" + (date.getDate());
      let hours = (date.getHours()) > 9 ? (date.getHours()) : "0" + (date.getHours());
      let minutes = (date.getMinutes()) > 9 ? (date.getMinutes()) : "0" + (date.getMinutes());
      let seconds = (date.getSeconds()) > 9 ? (date.getSeconds()) : "0" + (date.getSeconds());

      let dateString =
          date.getFullYear() + "-" +
          month + "-" +
          day + " " +
          hours + ":" +
          minutes
          
      return dateString; 
    },
    formatter(type, value) {
      if (type === 'year') {
        return `${value}年`;
      } else if (type === 'month') {
        return `${value}月`
      }else if (type == 'day') {
        return `${value}日`
      }else if (type == 'hour') {
        return `${value}点`
      }else if (type == 'minute') {
        return `${value}分`
      }
      return value;
    },

    
    
  },
  computed: {
    ...mapState([
    ]),

    computedAvatar() {
      if(this.studentInfo.sex == 1) {
        return avatarBoy
      }else{
        return avatarGirl
      } 
    },

    computedSignClass() {
      return function(item) {
        if(item.checkStatus == 1) {
          return 'icon_signIn'
        }else{
          return 'icon_notSignIn'
        }
      }
    }
   
  },
  components: {
  },
}

</script>